package com.ny.service.impl;

import com.ny.dao.ProductDao;
import com.ny.dao.impl.ProductDaoImpl;
import com.ny.entity.Product;
import com.ny.service.ProductService;

import java.sql.SQLException;
import java.util.List;


public class ProductServiceImpl implements ProductService {
    private ProductDao productDao = new ProductDaoImpl();

    @Override
    public int updateProductStock(int productId, int number) throws Exception {
        return productDao.updateProductStock(productId, number);
    }

    @Override
    public int insertProduct(Product product) throws Exception {
        return  productDao.insertProduct(product);
    }

    @Override
    public Product getProductById(int id) throws Exception {
        return  productDao.getProductById(id);
    }

    @Override
    public int deleteProduct(int id) throws Exception {
        return  productDao.deleteProduct(id);
    }

    @Override
    public int updateProduct(Product product) throws Exception {
        return productDao.updateProduct(product);
    }

    @Override
    public List<Product> findAllProduct() throws Exception {
        return productDao.findAllProduct();
    }
}
